<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home_model extends MY_Model
{
    function Home_model()
    {
        parent::MY_Model();
    }
	function ww_update_quantity_military($uid, $oasis_orderid=0, $strComplete, $lstid)
	{
		$this->exeQuery("CALL ww_update_quantity_military('$uid', '$oasis_orderid', '$strComplete', '$lstid');");
	}
	function ww_get_train_user_info($uid, $oasis_orderid=0)
	{
		return $this->getRows("CALL ww_get_train_user_info($uid, $oasis_orderid);", 1);
	}
	function ww_get_res_user_info_by_field($uid, $oasis_orderid=0)
	{
		return $this->getRows("CALL ww_get_res_user_info_by_field('$uid', '$oasis_orderid')", 0);
	}
	function ww_update_res_by_hour($uid, $oasis_orderid=0, $food, $wood, $metal, $petroleum, $time)
	{
		$this->exeQuery("CALL ww_update_res_by_hour('$uid', '$oasis_orderid', '$food', '$wood', '$metal', '$petroleum', '$time');");
	}
	function ww_get_units_user_info($uid, $oasis_orderid=0)
	{
		return $this->getRows("CALL ww_get_units_user_info('$uid', '$oasis_orderid');", 0);
	}
	function ww_update_training_military($uid, $oasis_orderid=0, $unit, $lquantity, $timestamp, $eachtime, $fixtime, $status)
	{
	   //var_dump($uid, $oasis_orderid, $unit, $lquantity, $timestamp, $eachtime, $fixtime, $status);die();
		/*
		*	$troop_code = uid:
			$unit = ma quan;
			$amt = so luong;
			$timestamps = thoi gian tao
			$eachtime = so giay hoan thanh
		*
		*/
		$this->exeQuery("CALL ww_update_training_military('$uid', '$oasis_orderid', '$unit', '$lquantity', '$timestamp', '$eachtime', '$fixtime', '$status');", 0);
	}
	function ww_update_quantity_for_time($id, $uid, $oasis_orderid, $quantity)
	{
		$this->exeQuery("CALL ww_update_quantity_for_time('$id', '$uid', '$oasis_orderid', '$quantity');");
	}
    function ww_get_all_troop_in_oasis($userid, $user_oasis_orderid, $typeview)
    {
        return $this->getRows("CALL ww_get_all_troop_in_oasis('$userid', '$user_oasis_orderid', '$typeview')", $typeview);
    }
}